Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for LCD hardware cursor #556

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nitinseshadri
Copy link

This PR adds API to make interacting with the LCD's hardware cursor easier.

@mateoconlechuga
Copy link
Member

mateoconlechuga commented Mar 15, 2025

You need to wrap most of these macros in a do {} while (0) construct.

@nitinseshadri
Copy link
Author

done!

@adriweb
Copy link
Member

adriweb commented Mar 22, 2025

Did you have any demo/example code that uses this btw? :)

@nitinseshadri
Copy link
Author

PETSCII Robots CE uses this to display search, move, and use cursors. The only difference is that it is implemented as functions in a header file (cursor.h) as opposed to macros here in this PR. You can have PETSCII Robots use the macros through a find and replace of instances of cursor_ to lcd_Crsr in PlatformCE.cpp (e.g. cursor_Setup() would become lcd_CrsrSetup()).

@mateoconlechuga
Copy link
Member

I think the question was if you could add an example to the toolchain so other people can have a reference on how to use it 😉

@nitinseshadri
Copy link
Author

Got it, I added an example to the PR.

@calc84maniac
Copy link
Contributor

I think it would also be good to have methods to set the cursor clip amount and the cursor image index, as well as a way to explicitly set the data for a 32x32 or 64x64 image (the former allowing to specify an image index). You could still keep the existing generic data set method that checks the current cursor size and implies image index 0, if that makes things easier. Also accordingly, the cursor show/hide methods should be updated to avoid overwriting the image index (for example, with lcd_CrsrCtrl |= 1;)

@nitinseshadri
Copy link
Author

done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants